package com.learn.configuration;

import com.learn.feign_service.DeptFeignService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class HystrixFallbackFactoryImpl implements FallbackFactory<DeptFeignService> {
    @Override
    public DeptFeignService create(Throwable throwable) {
        return new DeptFeignService() {
            @Override
            public String addDept(String name) {
                return "服务消费者的快速响应方法";
            }
            
            @Override
            public String findOneDept(Integer id) {
                return "服务消费者的快速响应方法";
            }
            
            @Override
            public String findAllDept() {
                return "服务消费者的快速响应方法";
            }
            
            @Override
            public String findOneDeptHystrix(Integer id) {
                return "服务消费者的快速响应方法";
            }
        };
    }
}
